<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Happy dong
 * Created Time: 2019-06-25 09:36
 * Modified Time: 2019-06-25 09:36
 * Version: 2.0
 */
namespace App\Modules\Employee\Validators;
use Flower\Core\Repository\Contracts\ValidatorInterface;
use Flower\Core\Repository\Validator\LaravelValidator;
class EmployeeValidator extends LaravelValidator
{
    protected $rules = [
        ValidatorInterface::RULE_CREATE => [
        	// 手机号码 必填 唯一性验证 正则匹配验证
            'mobile' => 'sometimes|required|unique:user|regex:/^1[3456789][0-9]{9}$/',
	        'password' =>'sometimes|required',
	        'nick'     => 'sometimes|min:6|max:12',
	        'email'     => 'sometimes|email',
	        'portrait'  => 'sometimes|mimes:jpeg,bmp,png,jpg',
	        'introduction' =>'sometimes|max:200',
	        'id'        => 'sometimes|required',
        ]
    ];
    protected $messages = [
    	'id.required'  => '用户id不能为空',
        'mobile.required' => '手机号不能为空',
	    'mobile.unique'   => '手机号已经被注册，请换新的号码注册！',
	    'mobile.regex'    => '手机号格式不对,请修正后继续注册',
        'password.required' => '密码不能为空',
	    'nick.min'        => '昵称长度最少6个字符！',
	    'nick.max'          => '昵称长度最多12个字符',
	    'portrait.mimes'    => '头像上传格式不对，支持格式jpeg,bmp,png,jpg',
	    'introduction.max'  => '自我介绍长度超出范围, 最大长度200个字符！',
    ];
}